QuickOPC User's Guide and Reference
Combine<TSecondValue,TResultValue>(ValueResult,ValueResult<TSecondValue>,Func<Object,TSecondValue,TResultValue>) Method



OpcLabs.BaseLib Assembly > OpcLabs.BaseLib.OperationModel Namespace > ValueResult Class > Combine Method : Combine<TSecondValue,TResultValue>(ValueResult,ValueResult<TSecondValue>,Func<Object,TSecondValue,TResultValue>) Method
The type of value of the second value result.
The type of value of the resulting value result.
The first value result.
The second value result.
The function that combines the values of the first and second value result into a value of the resulting value result.
Combines two value results using a function that combines their values.
Syntax
'Declaration
 
<NotNullAttribute()>
Public Overloads Shared Function Combine
    (Of TSecondValue,TResultValue)( _
   ByVal first As ValueResult, _
   ByVal second As ValueResult(Of TSecondValue), _
   ByVal combineValuesFunction As Func(Of Object,TSecondValue,TResultValue) _
) As ValueResult(Of TResultValue)
'Usage
 
Dim first As ValueResult
Dim second As ValueResult(Of TSecondValue)
Dim combineValuesFunction As Func(Of Object,TSecondValue,TResultValue)
Dim value As ValueResult(Of TResultValue)
 
value = ValueResult.Combine(Of TSecondValue, TResultValue)(first, second, combineValuesFunction)

Parameters

first
The first value result.
second
The second value result.
combineValuesFunction
The function that combines the values of the first and second value result into a value of the resulting value result.

Type Parameters

TSecondValue
The type of value of the second value result.
TResultValue
The type of value of the resulting value result.

Return Value

If the first value result failed, returns failed value result made from the first value result. Otherwise, if the second value result failed, returns failed value result made from the second value result. Otherwise (i.e. when both the first and second value results succeeded), returns a success value result, containing a value returned by the combineValuesFunction for the values of the first and second value results.
Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

Remarks

The various overloads of this method allow to combine generic and non-generic value results.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also